package loan.calc.controller;

import com.alibaba.druid.stat.DruidStatManagerFacade;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("system")
@Tag(name = "system", description = "系统接口")
public class SystemController {

    @GetMapping("druid/stat")
    @Operation(summary = "获取druid数据监控信息")
    public List<Map<String, Object>> druidStat() {
        List<Map<String, Object>> dataSourceStatDataList = DruidStatManagerFacade.getInstance().getDataSourceStatDataList(true);
        return dataSourceStatDataList;
    }
}
